Home:ALL Converter>Connect directly to the "local" database of primary MongoDB node in replica set

Connect directly to the "local" database of primary MongoDB node in replica set

Ask Time:2016-02-07T22:16:32         Author:iamyojimbo

Json Formatter

I need access to the OpLog of the primary of my replica set in MongoDB. I am developing an OpLog driven ETL job as it is far more efficient than simply querying and transferring data from the entire table.

I can access the OpLog easily with the following steps in the terminal:

mongo mymongoserver.com:10733/my-db -u oplogUser -pxxxxxxxx

Then I run:

use local

and then I can query the OpLog using:

db.oplog.rs.find()

My question is: Are there any settings I can pass to the mongo connect command to get me straight into the local database for the primary node?

I am using Talend Open Studio for my ETL needs. Am I approaching this the wrong way?

I have come across this from the guys at Stripe, which means that this is definitely possible! https://www.mongodb.com/presentations/building-real-time-systems-mongodb-using-oplog-stripe

Author:iamyojimbo,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/35254572/connect-directly-to-the-local-database-of-primary-mongodb-node-in-replica-set
yy